package org.com.lcuiot.handler;

import org.com.lcuiot.database.dto.Result;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

/**
 * Handler处理层
 *
 * @author gaoge
 * @since 2022/11/20 12:49
 */
public class AbstractHandler {

    /**
     * 解析Result设置响应Http状态码
     *
     * @author gaoge
     * @since 2022/11/20 12:49
     */
    public Mono<ServerResponse> resolveResult(Result<Object> result) {
        return ServerResponse.status(result.getCode()).body(Mono.just(result),Result.class);
    }
}
